package work.huangxin.share.constant;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author 季台星
 * @Date 2023 04 15 16 11
 */
@Component
public class OssConstant implements InitializingBean {

    @Value("${OSS.accessKeyID}")
    private String accessKeyID;
    @Value("${OSS.accessKeySecret}")
    private String accessKeySecret;
    @Value("${OSS.endpoint}")
    private String endpoint;
    @Value("${OSS.bucketName}")
    private String bucketName;

    public static String ACCESS_ID = null;
    public static String ACCESS_SECRET = null;
    public static String ACCESS_ENDPOINT = null;
    public static String ACCESS_BUCKETNAME = null;

    public static final String OSS_PREFIX = "https://funcampus.oss-cn-guangzhou.aliyuncs.com/";




    /**
     * 回调接口
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {

        ACCESS_ID = accessKeyID;
        ACCESS_SECRET = accessKeySecret;
        ACCESS_ENDPOINT = endpoint;
        ACCESS_BUCKETNAME = bucketName;

    }
}
